package class101To110;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Manacher {

    public static final int MAX_N = 11000005;

    public static int[] ss = new int[MAX_N * 2];

    public static int[] p = new int[MAX_N * 2];

    public static int n;

    public static int manacher(String str) {
        mancherss(str.toCharArray());
        int max = 0;
        for (int i = 0, c = 0, r = 0, len; i < n; i++) {
            len = r > i ? Math.min(p[2 * c - i], r - i) : 1;
            while (i + len < n && i - len >= 0 && ss[i + len] == ss[i - len]) {
                len++;
            }
            if (i + len > r) {
                c = i;
                r = i + len;
            }
            max = Math.max(len, max);
            p[i] = len;
        }
        return max - 1;
    }

    public static void mancherss(char[] s) {
        n = s.length * 2 + 1;
        for (int i = 0, j = 0; i < n; i++) {
            ss[i] = (i & 1) == 0 ? '#' : s[j++];
        }
    }


    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        out.println(manacher(br.readLine()));
        out.flush();
        out.close();
        br.close();
    }
}
